package com.gary.domain;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * @author pengrui
 * @date 2020/11/12 - 10:47
 * @PropertySource 当前版本jdk1.8 springboot1.5.9 只支持properties文件的 不支持读取 yml文件 若使用yml文件 读取不到数据
 */
@PropertySource(value = {"classpath:userinfo.properties"})
@Component
@ConfigurationProperties(prefix = "userinfo")
public class User {
    private String name;
    private Integer age;
    private Boolean boss;

    public String getName() {
        return name;
    }

    public Integer getAge() {
        return age;
    }

    public Boolean getBoss() {
        return boss;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public void setBoss(Boolean boss) {
        this.boss = boss;
    }

    @Override
    public String toString() {
        return "User{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", boss=" + boss +
                '}';
    }
}
